﻿using System;
using System.Xml.Serialization;

namespace PrearrangedChaos.AgileZen.Service.Rest
{
    public abstract class PagingCollection<TModel> : IPagingResponse<TModel>
    {
        private int _pageField;
        private int _pageSizeField;
        private int _totalItemsField;
        private int _totalPagesField;

        /// <remarks/>
        [XmlElement(ElementName = "page")]
        public int Page
        {
            get
            {
                return this._pageField;
            }
            set
            {
                this._pageField = value;
            }
        }

        /// <remarks/>
        [XmlElement(ElementName = "pageSize")]
        public int PageSize
        {
            get
            {
                return this._pageSizeField;
            }
            set
            {
                this._pageSizeField = value;
            }
        }

        /// <remarks/>
        [XmlElement(ElementName = "totalItems")]
        public int TotalItems
        {
            get
            {
                return this._totalItemsField;
            }
            set
            {
                this._totalItemsField = value;
            }
        }

        /// <remarks/>
        [XmlElement(ElementName = "totalPages")]
        public int TotalPages
        {
            get
            {
                return this._totalPagesField;
            }
            set
            {
                this._totalPagesField = value;
            }
        }

        public abstract TModel[] GetItems();
    }
}